package com.zzyl.config;

import com.aliyun.iot20180120.Client;
import com.aliyun.teaopenapi.models.Config;
import com.zzyl.properties.AliIotProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

/**
 * wangcong
 * 2025/2/10 15:25
 */
@Component
public class AliIotConfig {
    @Autowired
    private AliIotProperties aliIotProperties;

    @Bean
    public Client getClient() throws Exception {
        Config config = new Config();
        config.setAccessKeyId(aliIotProperties.getAccessKeyId());
        config.setAccessKeySecret(aliIotProperties.getAccessKeySecret());
        config.setRegionId(aliIotProperties.getRegionId());
        return new Client(config);
    }
}
